package com.example.lanqiaodemo1.JavaTest;
public class Triangle {
    double A1,A2,A3;
    public Triangle(double A1,double A2,double A3){   //构造方法
        this.A1=A1;
        this.A2=A2;
        this.A3=A3;
    }
    public double getA1() {
        return A1;
    }
    public void setA1(double A1) { this.A1 = A1; }
    public double getA2() {
        return A2;
    }
    public void setA2(double A2) {
        this.A2 = A2;
    }
    public double getA3() {
        return A3;
    }
    public void setA3(double A3) {
        this.A3 = A3;
    }


    public  double getArea(){                              //面积
        double p=(A1+A2+A3)/2;
        return Math.sqrt(p*(p-A1)*(p-A2)*(p-A3));
    }


    public  double getPerimeter(){                         //周长
        return A1+A2+A3;
    }     //求周长

    public static void main(String[] args) {
        Triangle triangle = new Triangle(3,4,5);
        System.out.println(triangle.getPerimeter());  //输出周长
        System.out.println(triangle.getArea());       //输出面积

    }
}
